#include "profilereditor.h"

ProfilerEditor::ProfilerEditor()
{
    this->setFont(QFont(QStringList{"consolas","Microsoft Yahei"},13));
}

void ProfilerEditor::wheelEvent(QWheelEvent *e)
{
    if (e->modifiers() == Qt::ControlModifier)
    {
        if (e->angleDelta().y() > 0 && this->font().pointSize() < 80)
        {
            this->zoomIn(1);
        }
        else if (e->angleDelta().y() < 0 && this->font().pointSize() > 2)
        {
            this->zoomOut(1);
        }

        QFontMetrics fm(this->font());
        double fontWidth = fm.horizontalAdvance("a");
        this->setTabStopDistance(fontWidth * 8);
    }
    else
    {
        QPlainTextEdit::wheelEvent(e);
    }
}
